﻿
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ZFB.Models.EntityConfig
{
    
    public class MyDbContext: DbContext
    {
        public static readonly ILoggerFactory loggerFactory = LoggerFactory.Create(builder => { builder.AddConsole(); });
        public MyDbContext(DbContextOptions<MyDbContext> options) : base(options)
        {
           
        }

        //public virtual DbSet<Sysdiagrams> Sysdiagrams { get; set; }
        public virtual DbSet<T_AdminLogs> T_AdminLogs { get; set; }
        public virtual DbSet<T_AdminUsers> T_AdminUsers { get; set; }
        public virtual DbSet<T_Attachments> T_Attachments { get; set; }
        public virtual DbSet<T_Cities> T_Cities { get; set; }
        public virtual DbSet<T_Communities> T_Communities { get; set; }
        public virtual DbSet<T_HouseAppointments> T_HouseAppointments { get; set; }
        public virtual DbSet<T_HousePics> T_HousePics { get; set; }
        public virtual DbSet<T_Houses> T_Houses { get; set; }
        public virtual DbSet<T_IdNames> T_IdNames { get; set; }
        public virtual DbSet<T_Permissions> T_Permissions { get; set; }
        public virtual DbSet<T_Regions> T_Regions { get; set; }
        public virtual DbSet<T_Roles> T_Roles { get; set; }
        public virtual DbSet<T_Settings> T_Settings { get; set; }
        public virtual DbSet<T_Users> T_Users { get; set; }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            modelBuilder.ApplyConfigurationsFromAssembly(this.GetType().Assembly);
            
        }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            base.OnConfiguring(optionsBuilder);
            optionsBuilder.UseLoggerFactory(loggerFactory);
        }
    }
}
